<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="pop3-example.html" />
<link rel="prev" href="module-poplib.html" />
<link rel="parent" href="module-poplib.html" />
<link rel="next" href="pop3-example.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>18.10.1 POP3 Objects </title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="18.10 poplib  "
  href="module-poplib.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="18.10 poplib  "
  href="module-poplib.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="18.10.2 pop3 Example"
  href="pop3-example.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-poplib.html">18.10 poplib  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-poplib.html">18.10 poplib  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="pop3-example.html">18.10.2 POP3 Example</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION00201010000000000000000"></a><a name="pop3-objects"></a>
<br>
18.10.1 POP3 Objects 
</h2>

<p>
All POP3 commands are represented by methods of the same name,
in lower-case; most return the response text sent by the server.

<p>
An <tt class="class">POP3</tt> instance has the following methods:

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4086' xml:id='l2h-4086' class="method">set_debuglevel</tt></b>(</nobr></td>
  <td><var>level</var>)</td></tr></table></dt>
<dd>
Set the instance's debugging level.  This controls the amount of
debugging output printed.  The default, <code>0</code>, produces no
debugging output.  A value of <code>1</code> produces a moderate amount of
debugging output, generally a single line per request.  A value of
<code>2</code> or higher produces the maximum amount of debugging output,
logging each line sent and received on the control connection.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4087' xml:id='l2h-4087' class="method">getwelcome</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Returns the greeting string sent by the POP3 server.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4088' xml:id='l2h-4088' class="method">user</tt></b>(</nobr></td>
  <td><var>username</var>)</td></tr></table></dt>
<dd>
Send user command, response should indicate that a password is required.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4089' xml:id='l2h-4089' class="method">pass_</tt></b>(</nobr></td>
  <td><var>password</var>)</td></tr></table></dt>
<dd>
Send password, response includes message count and mailbox size.
Note: the mailbox on the server is locked until <tt class="method">quit()</tt> is
called.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4090' xml:id='l2h-4090' class="method">apop</tt></b>(</nobr></td>
  <td><var>user, secret</var>)</td></tr></table></dt>
<dd>
Use the more secure APOP authentication to log into the POP3 server.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4091' xml:id='l2h-4091' class="method">rpop</tt></b>(</nobr></td>
  <td><var>user</var>)</td></tr></table></dt>
<dd>
Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4092' xml:id='l2h-4092' class="method">stat</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Get mailbox status.  The result is a tuple of 2 integers:
<code>(<var>message count</var>, <var>mailbox size</var>)</code>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4093' xml:id='l2h-4093' class="method">list</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>which</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Request message list, result is in the form
<code>(<var>response</var>, ['mesg_num octets', ...], <var>octets</var>)</code>.
If <var>which</var> is set, it is the message to list.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4094' xml:id='l2h-4094' class="method">retr</tt></b>(</nobr></td>
  <td><var>which</var>)</td></tr></table></dt>
<dd>
Retrieve whole message number <var>which</var>, and set its seen flag.
Result is in form  <code>(<var>response</var>, ['line', ...], <var>octets</var>)</code>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4095' xml:id='l2h-4095' class="method">dele</tt></b>(</nobr></td>
  <td><var>which</var>)</td></tr></table></dt>
<dd>
Flag message number <var>which</var> for deletion.  On most servers
deletions are not actually performed until QUIT (the major exception is
Eudora QPOP, which deliberately violates the RFCs by doing pending
deletes on any disconnect).
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4096' xml:id='l2h-4096' class="method">rset</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Remove any deletion marks for the mailbox.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4097' xml:id='l2h-4097' class="method">noop</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Do nothing.  Might be used as a keep-alive.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4098' xml:id='l2h-4098' class="method">quit</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Signoff:  commit changes, unlock mailbox, drop connection.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4099' xml:id='l2h-4099' class="method">top</tt></b>(</nobr></td>
  <td><var>which, howmuch</var>)</td></tr></table></dt>
<dd>
Retrieves the message header plus <var>howmuch</var> lines of the message
after the header of message number <var>which</var>. Result is in form
<code>(<var>response</var>, ['line', ...], <var>octets</var>)</code>.

<p>
The POP3 TOP command this method uses, unlike the RETR command,
doesn't set the message's seen flag; unfortunately, TOP is poorly
specified in the RFCs and is frequently broken in off-brand servers.
Test this method by hand against the POP3 servers you will use before
trusting it.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4100' xml:id='l2h-4100' class="method">uidl</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>which</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return message digest (unique id) list.
If <var>which</var> is specified, result contains the unique id for that
message in the form <code>'<var>response</var> <var>mesgnum</var> <var>uid</var></code>,
otherwise result is list <code>(<var>response</var>, ['mesgnum uid', ...],
<var>octets</var>)</code>.
</dl>

<p>
Instances of <tt class="class">POP3_SSL</tt> have no additional methods. The
interface of this subclass is identical to its parent.

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="18.10 poplib  "
  href="module-poplib.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="18.10 poplib  "
  href="module-poplib.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="18.10.2 pop3 Example"
  href="pop3-example.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-poplib.html">18.10 poplib  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-poplib.html">18.10 poplib  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="pop3-example.html">18.10.2 POP3 Example</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
